home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / RIncludes / Collections.r < prev    next >
Encoding:
Text File  |  1998-08-17  |  3.0 KB  |  105 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        Collections.r
  3.  
  4.      Contains:    Collection Manager Interfaces
  5.  
  6.      Version:    Technology:    System 7.x
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1989-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17.  
  18. #ifndef __COLLECTIONS_R__
  19. #define __COLLECTIONS_R__
  20.  
  21. #ifndef __CONDITIONALMACROS_R__
  22. #include "ConditionalMacros.r"
  23. #endif
  24.  
  25. // 'cltn' - definition of a collection resource (loaded by GetNewCollection)
  26. type 'cltn' {
  27.     longint = $$CountOf(ItemArray);
  28.     array ItemArray
  29.         {
  30.         longint;    // tag
  31.         longint;    // id
  32.             boolean        itemUnlocked            =    false,    // defined attributes bits...
  33.                         itemLocked                =    true;
  34.             boolean        itemNonPersistent        =    false,
  35.                         itemPersistent            =    true;
  36.             unsigned bitstring[14] = 0;                        // reserved attributes bits...
  37.             unsigned bitstring[16];                            // user attributes bits...
  38.         wstring;
  39.         align word;
  40.     };
  41. };
  42.  
  43. // 'flac' - definition of a flattened collection (created by Flatten[Partial]Collection)
  44. // Note that due to the complexity of this format, it is possible to create 'flac' resources
  45. // using Rez, but it is not possible to DeRez them. DeRez cannot currently handle multiple
  46. // undefined labels as used in this type definition. Instead, DeRez just emits the raw data.
  47. // Some important other limitations:
  48. //     Zero-length items aren't supported.
  49. //     Entries in the item array must be sorted by tag and ID.
  50. //     Entries in the data array must be in the same order as corresponding item array entries.
  51. // Here's an example of using the 'flac' resource type:
  52. //     resource 'flac' (128)
  53. //     {
  54. //         0x40000020,
  55. //         {
  56. //             'TEST', 2, itemUnlocked, itemPersistent, 0x02,
  57. //             'TEST', 3, itemUnlocked, itemPersistent, 0x04,
  58. //             'TEST', 4, itemUnlocked, itemPersistent, 0x08
  59. //         },
  60. //         {
  61. //             "foo",
  62. //             "bird",
  63. //             "The quick brown fox jumped over the lazy dog"
  64. //         }
  65. //     };
  66. type 'flac'
  67. {
  68.     longint = 0x00010000;            // version
  69.     longint    noAttributes = 0;            // default collection attributes
  70.     longint = $$CountOf(ItemArray);        // number of items
  71.     array ItemArray            // array of items
  72.     {
  73.         literal longint;    // tag
  74.         longint;            // id
  75.         boolean        itemUnlocked        =    false,    // defined attributes bits
  76.                     itemLocked            =    true;
  77.         boolean        itemNonPersistent    =    false,
  78.                     itemPersistent        =    true;
  79.         unsigned bitstring[14] = 0;                    // reserved attributes bits
  80.         unsigned bitstring[16];                        // user attributes bits
  81.         
  82.         // offset in data block to item data (to the data itself, not to the length)
  83.         longint = (itemData[$$ArrayIndex(ItemArray)] - dataStart) / 8;
  84.     };
  85. dataSize:
  86.     longint = ((dataEnd - dataSize) / 8) - 4;        // size of data
  87. dataStart:
  88.     array ItemDataArray
  89.     {
  90. itemSize:
  91.         // size of this item's data
  92.         longint = ((itemEnd[$$ArrayIndex(ItemDataArray)] - itemSize[$$ArrayIndex(ItemDataArray)]) / 8) - 4;
  93. itemData:
  94.         hex string;            // the item's data
  95. itemEnd:
  96.         ;
  97.         align word;
  98.     };
  99. dataEnd:
  100.     ;
  101. };
  102.  
  103. #endif /* __COLLECTIONS_R__ */
  104.  
  105.